#面向对象


#定义方法
class Animal :
    name='animal'
    def shout(self) :
        print('animal shout')


#创建实例
animal=Animal()
animal.shout()
print(animal.name)


class Dog :
    name = 'dog'
    def eat(self) :
        self.age = 18
        print('Dog eat')

    def __init__(self):
        self.age=12
        #print('Dog init')
        print("构造函数")

dog1=Dog()
dog1.eat()
print(dog1.name)
print(dog1.name.split('o'))

#修改对象的类属性
dog1.name=111
print(dog1.name)
print(Dog.name)

#修改类的类属性   只有类能更改属性
Dog.name=111
print(Dog.name)
print(dog1.name)
print("_________________________________________")
dog2 = Dog()
dog2.eat()
print(dog2.name)
print("_________________________________________")
print(dog2.age)
print("_________________________________________")
dog2.sleep = '10h'
print(dog2.sleep)
print("_________________________________________")
#print(Dog.sleep)  不起作用